<?php
/**
 * Created by PhpStorm.
 * User: angl
 * Date: 2016/12/6
 * Time: 18:51
 */

namespace AuctionCore\CarResource;


class CarSource
{
    private $sid = null;

    /**
     * CarSource constructor.
     * @param $sid
     */
    public function __construct($sid)
    {
        $this->sid = $sid;
    }

    /**
     * @return mixed
     */
    public function getInfo()
    {
        $map = [
            'sid' => $this->sid,
        ];
        return M("car_source")->where($map)->find();
    }

    /**
     * 更新车源信息
     * @param $data
     * @return bool
     */
    public function update($data)
    {
        $map = [
            'sid' => $this->sid,
        ];
        $data['last_update'] = date("Y-m-d H:i:s");
        return M("car_source")->where($map)->save($data);
    }

}